Suffolk County police responded to the store at 362 Veterans Memorial Highway, in Commack, around 9:45 p.m., Tuesday, June 23, on a report of a distance.
During the disturbance, police said Robert Sperduti, 22, of Huntington, displayed a handgun to the cashier.
When police arrived, Sperduti attempted to flee but was apprehended a short time later.
At the same time, police also apprehended Robert Cano, 19, of Smithtown, who was allegedly found to be in possession of Xanax without a prescription, police said.
Following an investigation, it was determined that Cano sold the gun to Sperduti, they added.
Sperduti was charged with two counts of criminal possession of a weapon, and menacing.
Cano was charged with criminal sale of a firearm and criminal possession of a controlled substance.
Both men are scheduled for arraignment at First District Court in Central Islip on Wednesday, June 24.
Click here to follow Daily Voice Brentwood and receive free news updates.